Dynomotion

Group: DynoMotion Message: 6039 From: tbondhus Date: 11/12/2012
Subject: Move to a stop, jerking problem
I'm trying to move an axis until it hits a stop, and then stop. I want to set the force so it won't crush fragile stuff.

I got it to move to a stop, and stop in the negative direction, but when I try to move to a stop in the positive direction, it stops, but then after about a second or two it jerks. A big enough jerk in the positive direction, that could easily crush something somewhat fragile.

Is there any way to stop it from jerking? Or is there a better way to do this?

My program looks like this:

ch2->Vel = 20 * (Conv_to_Cycles/60);
ch2->MaxOutput = 10;
int Last_Pos = ch2->Position +10;
Move(2, ( +0.5 * Conv_to_Cycles));
while ((Last_Pos - 5 <= ch2->Position) |
((Last_Pos + 5) >= ch2->Position))
{ // wait till we hit the stop
Last_Pos = ch2->Position;
Delay_sec(0.05);
if (CheckDone(2)) break;
}

// Jog(2,0); // this didn't seem to work
Move(2, ( ch2->Position));
while (!CheckDone(2));

Also, I tried measuring current, but I didn't get any realistic results. MeasuredAxisAmps(2) gave me a number which never changes. On the Analog Status screen, ADC #10 shows changes and is probably what I need, but ADC(10) doesn't give me a realistic number that changes either (reads zero I think).

I was thinking if I could measure current, I might be able to use that to stop it, but I'd still need it to stop without jerking.



Tony
Group: DynoMotion Message: 6043 From: Tom Kerekes Date: 11/12/2012
Subject: Re: Move to a stop, jerking problem
Hi Tony,

Driving a servo into a hard stop can be tricky.  I tried to understand what you were trying to do with the program.  It seems a large move is commanded at some speed that will hit the stop.   Then as it is moving the encoder position is sampled every 50ms and if it doesn't change by more than 5 counts it is assumed we hit the stop and we command to servo where we currently are.

You forgot to specify what the variable Conv_to_Cycles is, but from an earlier email I see it was:

#define Conv_to_Cycles 41615.36

So the commanded velocity is:


41615.36/60 * 20 = 13871 counts/sec

The amount moved every 0.05 sec would be 693 counts per sample


You might consider sampling faster.  10X faster every 0.005 sec would still nominally move ~70 counts per sample.


But depending on how your servo is tuned it may not like servoing while at or in a hard stop. The main issue with doing this is usually with the integrator.  If the servo can not reach the commanded position then the integrator will ramp up the motor current and force forever trying to drive the error to zero (often referred to as integrator wind up).  You can limit this problem by reducing the Max Integrator value.  Also after the hard stop is detected and the motor is pressing hard into the stop we should command a move to a position slightly away from the hard stop.

You can observe how all this works using the Step Response screen.  Command a similar move that hits the hard stop.  You can then plot and view everything.  Following error, motor current, Output ramping up, and so forth.

Regards
TK